@extends('layouts.admin')

@section('content')

<style type="text/css">
.delegate{margin:10px;}
</style>
<div class="page-content">

    <div class="row">

        <div class="col-xs-12">

            <div class="table-header">通知管理</div>

            <div class="table-responsive">

                <table id="sample-table-2" class="table table-striped table-bordered table-hover">
                    <thead>
                        <tr>
                            <th>文章标题</th>
                            <th style="width:100px">操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach($articles as $article)
                        <tr>
                            <td><a href="{{ url('article/'.$article->id) }}">{{$article->title}}</a></td>
                            <td>
                                <form action="{{ url('article/'.$article->id) }}" method="POST" style="display: inline;">
                                    {{ method_field('DELETE') }}
                                    {{ csrf_field() }}
                                    <button type="submit" class="btn btn-sm">删除</button>
                                </form>
                            </td>
                        </tr>
                        @endforeach
                    </tbody>

                </table>

            </div>
            <div> 
                @if (count($errors) > 0)
                    <div class="alert alert-danger">
                        {!! implode('<br>', $errors->all()) !!}
                    </div>
                @endif
            </div>
        </div>

    </div>

    <div class="row">
        <div class="form-actions center delegate-list">
            <hr id="split-line">
            <a class="btn btn-sm btn-success center" href="/article/create">
                新增通知</a>
        </div>
    </div>

</div>

<script type="text/javascript">

    jQuery(function($) {

        var oTable1 = $('#sample-table-2').dataTable( {
            "aoColumns": [
              { "bSortable": false },
              null,
            ],
            "oLanguage": {
            "sLengthMenu": "每页显示 _MENU_ 条记录",
            "sZeroRecords": "抱歉， 没有找到",
            "sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
            "sInfoEmpty": "没有数据",
            "sInfoFiltered": "(从 _MAX_ 条数据中检索)",
            "oPaginate": {
                "sFirst": "首页",
                "sPrevious": "前一页",
                "sNext": "后一页",
                "sLast": "尾页"
            },
            "sZeroRecords": "没有检索到数据",
            }
         });
    });

    
</script>


@endsection
